package com.sky.context;

public class BaseContext {
    //定义线程局部变量
    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    //在线程的独立空间里面存入值，局部变量
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }
    //获取存入线程独立空间的值
    public static Long getCurrentId() {
        return threadLocal.get();
    }
    //移除当前线程局部变量
    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
